{smcl}
{txt}{sf}{ul off}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}E:\Github\Bolivia\00_replication_files\log-files/2_Figure_H3.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}25 Jan 2022, 22:39:22
{txt}
{com}. 
. timer on 2
{txt}
{com}. 
. *------------*
. * Figure H.3 *
. *------------*
.         * Figure H.3.a
.         *-------------
.                 use "data/outputs/computo_verificadortrepdate_missingsatthend.dta", clear       
{txt}
{com}. 
.                 * Nulos share
.                 gen nulosshare = Nulos / total_nbnn
{txt}(4 missing values generated)

{com}. 
.                 * Margin
.                 gen margin_nbnn = mshare_nbnn - cshare_nbnn
{txt}(4 missing values generated)

{com}. 
.                 * Recinto ID
.                 egen reci_id = group(Pais Dep Prov Muni Loc Reci)
{txt}
{com}.                            /* Note, in constructing the data set we made a correction
>                            such that recinto names are unique within localities. */
. 
.                 foreach var of varlist mshare_nbnn cshare_nbnn margin_nbnn nulosshare {c -(}
{txt}  2{com}.                         egen reci_mean = mean(`var'), by(reci_id)
{txt}  3{com}.                         gen `var'_dm = `var' - reci_mean 
{txt}  4{com}.                         drop reci_mean
{txt}  5{com}.                         qui su `var'
{txt}  6{com}.                         gen `var'_dm_plus = `var'_dm + `r(mean)' // Add overall mean for scale
{txt}  7{com}.                 {c )-}
{txt}(4 missing values generated)
(4 missing values generated)
(4 missing values generated)
(4 missing values generated)
(4 missing values generated)
(4 missing values generated)
(4 missing values generated)
(4 missing values generated)

{com}.                         
.                 * Cutoff
.                 quietly sum pcs_nbnn if trep_date_verificador >= tc(20oct2019 19:40:57) & ///
>                         trep_date_verificador <= tc(20oct2019 19:40:58), detail
{txt}
{com}.                 local cutoff = `r(min)' 
{txt}
{com}.                 local label = round(`cutoff', .01)
{txt}
{com}. 
.                 lprobust margin_nbnn_dm pcs_nbnn, genvars
{res}
Local Polynomial Regression Estimation and Inference.

{txt}{lalign 1: Sample size                              (n=)    }{col 19}{res}          34551
{txt}{lalign 1: Polynomial order for point estimation    (p=)    }{col 19}{res}              1
{txt}{lalign 1: Order of derivative estimated            (v=)    }{col 19}{res}              0
{txt}{lalign 1: Polynomial order for confidence interval (q=)    }{col 19}{res}              2
{txt}{lalign 1: Kernel function                                  }{col 19}{res}{ralign 15: Epanechnikov}
{txt}{lalign 1: Bandwidth selection method                       }{col 19}{res}{ralign 15: imse-dpi}

{txt}{hline 72}
{ralign 4: }{col 4}{ralign 10: }{col 14}{ralign 10: }{col 24}{ralign 8: }{col 32}{ralign 10: Point}{col 42}{ralign 10: Std.}{col 52}{ralign 20: Robust B.C.}{col 72}
{ralign 4: }{col 4}{ralign 10: eval}{col 14}{ralign 10: bw}{col 24}{ralign 8: Eff.n}{col 32}{ralign 10: Est.}{col 42}{ralign 10: Error}{col 52}{ralign 20: 95% Conf. Interval}{col 72}
{hline 72}
   1{col 4}{res}    0.0152{col 14}    0.4007{col 24}   15102{col 32}   -0.0032{col 42}    0.0014{col 52}   -0.0058{col 62}    0.0014{col 72}
{txt}   2{col 4}{res}    0.0382{col 14}    0.4007{col 24}   15858{col 32}   -0.0031{col 42}    0.0013{col 52}   -0.0055{col 62}    0.0001{col 72}
{txt}   3{col 4}{res}    0.0674{col 14}    0.4007{col 24}   16805{col 32}   -0.0029{col 42}    0.0011{col 52}   -0.0051{col 62}   -0.0007{col 72}
{txt}   4{col 4}{res}    0.0981{col 14}    0.4007{col 24}   17804{col 32}   -0.0027{col 42}    0.0010{col 52}   -0.0048{col 62}   -0.0009{col 72}
{txt}   5{col 4}{res}    0.1299{col 14}    0.4007{col 24}   18841{col 32}   -0.0026{col 42}    0.0009{col 52}   -0.0046{col 62}   -0.0009{col 72}
{txt}{hline 72}
   6{col 4}{res}    0.1626{col 14}    0.4007{col 24}   19908{col 32}   -0.0024{col 42}    0.0008{col 52}   -0.0045{col 62}   -0.0007{col 72}
{txt}   7{col 4}{res}    0.1955{col 14}    0.4007{col 24}   20985{col 32}   -0.0022{col 42}    0.0007{col 52}   -0.0043{col 62}   -0.0005{col 72}
{txt}   8{col 4}{res}    0.2287{col 14}    0.4007{col 24}   22093{col 32}   -0.0019{col 42}    0.0007{col 52}   -0.0040{col 62}   -0.0002{col 72}
{txt}   9{col 4}{res}    0.2621{col 14}    0.4007{col 24}   23189{col 32}   -0.0017{col 42}    0.0007{col 52}   -0.0038{col 62}   -0.0000{col 72}
{txt}  10{col 4}{res}    0.2955{col 14}    0.4007{col 24}   24299{col 32}   -0.0014{col 42}    0.0006{col 52}   -0.0035{col 62}    0.0002{col 72}
{txt}{hline 72}
  11{col 4}{res}    0.3295{col 14}    0.4007{col 24}   25373{col 32}   -0.0011{col 42}    0.0006{col 52}   -0.0031{col 62}    0.0005{col 72}
{txt}  12{col 4}{res}    0.3634{col 14}    0.4007{col 24}   26490{col 32}   -0.0008{col 42}    0.0006{col 52}   -0.0027{col 62}    0.0009{col 72}
{txt}  13{col 4}{res}    0.3973{col 14}    0.4007{col 24}   27587{col 32}   -0.0005{col 42}    0.0006{col 52}   -0.0023{col 62}    0.0013{col 72}
{txt}  14{col 4}{res}    0.4312{col 14}    0.4007{col 24}   26801{col 32}   -0.0002{col 42}    0.0006{col 52}   -0.0019{col 62}    0.0017{col 72}
{txt}  15{col 4}{res}    0.4655{col 14}    0.4007{col 24}   26586{col 32}    0.0001{col 42}    0.0006{col 52}   -0.0016{col 62}    0.0020{col 72}
{txt}{hline 72}
  16{col 4}{res}    0.4997{col 14}    0.4007{col 24}   26491{col 32}    0.0004{col 42}    0.0006{col 52}   -0.0013{col 62}    0.0022{col 72}
{txt}  17{col 4}{res}    0.5340{col 14}    0.4007{col 24}   26470{col 32}    0.0006{col 42}    0.0006{col 52}   -0.0010{col 62}    0.0025{col 72}
{txt}  18{col 4}{res}    0.5681{col 14}    0.4007{col 24}   26526{col 32}    0.0009{col 42}    0.0006{col 52}   -0.0007{col 62}    0.0028{col 72}
{txt}  19{col 4}{res}    0.6022{col 14}    0.4007{col 24}   26553{col 32}    0.0011{col 42}    0.0006{col 52}   -0.0004{col 62}    0.0031{col 72}
{txt}  20{col 4}{res}    0.6355{col 14}    0.4007{col 24}   25435{col 32}    0.0013{col 42}    0.0006{col 52}   -0.0001{col 62}    0.0035{col 72}
{txt}{hline 72}
  21{col 4}{res}    0.6694{col 14}    0.4007{col 24}   24301{col 32}    0.0015{col 42}    0.0006{col 52}    0.0002{col 62}    0.0038{col 72}
{txt}  22{col 4}{res}    0.7032{col 14}    0.4007{col 24}   23176{col 32}    0.0017{col 42}    0.0006{col 52}    0.0004{col 62}    0.0041{col 72}
{txt}  23{col 4}{res}    0.7382{col 14}    0.4007{col 24}   22030{col 32}    0.0019{col 42}    0.0007{col 52}    0.0006{col 62}    0.0043{col 72}
{txt}  24{col 4}{res}    0.7721{col 14}    0.4007{col 24}   20917{col 32}    0.0020{col 42}    0.0007{col 52}    0.0007{col 62}    0.0045{col 72}
{txt}  25{col 4}{res}    0.8067{col 14}    0.4007{col 24}   19778{col 32}    0.0022{col 42}    0.0007{col 52}    0.0007{col 62}    0.0044{col 72}
{txt}{hline 72}
  26{col 4}{res}    0.8403{col 14}    0.4007{col 24}   18675{col 32}    0.0022{col 42}    0.0008{col 52}    0.0006{col 62}    0.0042{col 72}
{txt}  27{col 4}{res}    0.8741{col 14}    0.4007{col 24}   17578{col 32}    0.0023{col 42}    0.0009{col 52}    0.0006{col 62}    0.0041{col 72}
{txt}  28{col 4}{res}    0.9073{col 14}    0.4007{col 24}   16498{col 32}    0.0023{col 42}    0.0010{col 52}    0.0004{col 62}    0.0042{col 72}
{txt}  29{col 4}{res}    0.9395{col 14}    0.4007{col 24}   15450{col 32}    0.0023{col 42}    0.0011{col 52}   -0.0002{col 62}    0.0045{col 72}
{txt}  30{col 4}{res}    0.9705{col 14}    0.4007{col 24}   14435{col 32}    0.0022{col 42}    0.0013{col 52}   -0.0012{col 62}    0.0051{col 72}
{txt}{hline 72}

{com}. 
.                 twoway (line lprobust_gx_bc lprobust_eval, ///
>                                         lcolor(gs6) lwidth(medthick)) ///
>                         (line lprobust_CI_l_rb lprobust_eval, ///
>                                 lcolor(gs6) lwidth(thin) lpattern(dash)) ///
>                         (line lprobust_CI_r_rb lprobust_eval, ///
>                                 lcolor(gs6) lwidth(thin) lpattern(dash)), ///
>                         graphregion(color(white)) ///
>                         xline(`cutoff', lcolor(black) lpattern(dash)) ///
>                         ylab(, angle(0)) ///
>                         xlab(0 `cutoff' "`label'" 1) ///
>                         ytitle("Booth-level MAS Margin Minus Precinct Mean") ///
>                         xtitle("Proportion of Preliminary Vote Counted") ///
>                         xsize(7) ysize(5) ///
>                         legend(off)
{res}{txt}
{com}.                 graph export "outputs/generated/Figure_H3a.pdf", replace
{txt}(file outputs/generated/Figure_H3a.pdf written in PDF format)

{com}. 
.         * Figure H.3.b
.         *-------------
.                 cap drop lprobust*
{txt}
{com}.                 lprobust margin_nbnn_dm pcs_nbnn, genvars h(0.15)
{res}
Local Polynomial Regression Estimation and Inference.

{txt}{lalign 1: Sample size                              (n=)    }{col 19}{res}          34551
{txt}{lalign 1: Polynomial order for point estimation    (p=)    }{col 19}{res}              1
{txt}{lalign 1: Order of derivative estimated            (v=)    }{col 19}{res}              0
{txt}{lalign 1: Polynomial order for confidence interval (q=)    }{col 19}{res}              2
{txt}{lalign 1: Kernel function                                  }{col 19}{res}{ralign 15: Epanechnikov}
{txt}{lalign 1: Bandwidth selection method                       }{col 19}{res}{ralign 15: imse-dpi}

{txt}{hline 72}
{ralign 4: }{col 4}{ralign 10: }{col 14}{ralign 10: }{col 24}{ralign 8: }{col 32}{ralign 10: Point}{col 42}{ralign 10: Std.}{col 52}{ralign 20: Robust B.C.}{col 72}
{ralign 4: }{col 4}{ralign 10: eval}{col 14}{ralign 10: bw}{col 24}{ralign 8: Eff.n}{col 32}{ralign 10: Est.}{col 42}{ralign 10: Error}{col 52}{ralign 20: 95% Conf. Interval}{col 72}
{hline 72}
   1{col 4}{res}    0.0152{col 14}    0.1500{col 24}    6774{col 32}   -0.0016{col 42}    0.0019{col 52}   -0.0050{col 62}    0.0033{col 72}
{txt}   2{col 4}{res}    0.0382{col 14}    0.1500{col 24}    7558{col 32}   -0.0025{col 42}    0.0015{col 52}   -0.0060{col 62}   -0.0001{col 72}
{txt}   3{col 4}{res}    0.0674{col 14}    0.1500{col 24}    8535{col 32}   -0.0032{col 42}    0.0012{col 52}   -0.0071{col 62}   -0.0014{col 72}
{txt}   4{col 4}{res}    0.0981{col 14}    0.1500{col 24}    9560{col 32}   -0.0033{col 42}    0.0010{col 52}   -0.0079{col 62}   -0.0020{col 72}
{txt}   5{col 4}{res}    0.1299{col 14}    0.1500{col 24}   10624{col 32}   -0.0031{col 42}    0.0010{col 52}   -0.0073{col 62}   -0.0016{col 72}
{txt}{hline 72}
   6{col 4}{res}    0.1626{col 14}    0.1500{col 24}   10775{col 32}   -0.0028{col 42}    0.0010{col 52}   -0.0061{col 62}   -0.0004{col 72}
{txt}   7{col 4}{res}    0.1955{col 14}    0.1500{col 24}   10258{col 32}   -0.0023{col 42}    0.0010{col 52}   -0.0047{col 62}    0.0011{col 72}
{txt}   8{col 4}{res}    0.2287{col 14}    0.1500{col 24}   10120{col 32}   -0.0018{col 42}    0.0010{col 52}   -0.0041{col 62}    0.0017{col 72}
{txt}   9{col 4}{res}    0.2621{col 14}    0.1500{col 24}   10021{col 32}   -0.0013{col 42}    0.0010{col 52}   -0.0037{col 62}    0.0022{col 72}
{txt}  10{col 4}{res}    0.2955{col 14}    0.1500{col 24}    9967{col 32}   -0.0009{col 42}    0.0010{col 52}   -0.0035{col 62}    0.0024{col 72}
{txt}{hline 72}
  11{col 4}{res}    0.3295{col 14}    0.1500{col 24}    9912{col 32}   -0.0009{col 42}    0.0010{col 52}   -0.0036{col 62}    0.0023{col 72}
{txt}  12{col 4}{res}    0.3634{col 14}    0.1500{col 24}    9876{col 32}   -0.0011{col 42}    0.0010{col 52}   -0.0041{col 62}    0.0018{col 72}
{txt}  13{col 4}{res}    0.3973{col 14}    0.1500{col 24}    9853{col 32}   -0.0009{col 42}    0.0010{col 52}   -0.0045{col 62}    0.0014{col 72}
{txt}  14{col 4}{res}    0.4312{col 14}    0.1500{col 24}    9833{col 32}   -0.0006{col 42}    0.0010{col 52}   -0.0041{col 62}    0.0018{col 72}
{txt}  15{col 4}{res}    0.4655{col 14}    0.1500{col 24}    9831{col 32}   -0.0002{col 42}    0.0010{col 52}   -0.0037{col 62}    0.0022{col 72}
{txt}{hline 72}
  16{col 4}{res}    0.4997{col 14}    0.1500{col 24}    9831{col 32}    0.0001{col 42}    0.0010{col 52}   -0.0030{col 62}    0.0028{col 72}
{txt}  17{col 4}{res}    0.5340{col 14}    0.1500{col 24}    9836{col 32}    0.0007{col 42}    0.0010{col 52}   -0.0018{col 62}    0.0039{col 72}
{txt}  18{col 4}{res}    0.5681{col 14}    0.1500{col 24}    9819{col 32}    0.0014{col 42}    0.0010{col 52}   -0.0009{col 62}    0.0046{col 72}
{txt}  19{col 4}{res}    0.6022{col 14}    0.1500{col 24}    9806{col 32}    0.0018{col 42}    0.0010{col 52}   -0.0006{col 62}    0.0049{col 72}
{txt}  20{col 4}{res}    0.6355{col 14}    0.1500{col 24}    9817{col 32}    0.0020{col 42}    0.0010{col 52}   -0.0008{col 62}    0.0049{col 72}
{txt}{hline 72}
  21{col 4}{res}    0.6694{col 14}    0.1500{col 24}    9816{col 32}    0.0020{col 42}    0.0010{col 52}   -0.0003{col 62}    0.0057{col 72}
{txt}  22{col 4}{res}    0.7032{col 14}    0.1500{col 24}    9830{col 32}    0.0021{col 42}    0.0010{col 52}   -0.0007{col 62}    0.0054{col 72}
{txt}  23{col 4}{res}    0.7382{col 14}    0.1500{col 24}    9847{col 32}    0.0021{col 42}    0.0010{col 52}   -0.0013{col 62}    0.0047{col 72}
{txt}  24{col 4}{res}    0.7721{col 14}    0.1500{col 24}    9850{col 32}    0.0022{col 42}    0.0010{col 52}   -0.0015{col 62}    0.0043{col 72}
{txt}  25{col 4}{res}    0.8067{col 14}    0.1500{col 24}    9949{col 32}    0.0022{col 42}    0.0010{col 52}   -0.0007{col 62}    0.0049{col 72}
{txt}{hline 72}
  26{col 4}{res}    0.8403{col 14}    0.1500{col 24}   10094{col 32}    0.0024{col 42}    0.0010{col 52}   -0.0002{col 62}    0.0052{col 72}
{txt}  27{col 4}{res}    0.8741{col 14}    0.1500{col 24}    9370{col 32}    0.0024{col 42}    0.0009{col 52}    0.0003{col 62}    0.0056{col 72}
{txt}  28{col 4}{res}    0.9073{col 14}    0.1500{col 24}    8291{col 32}    0.0024{col 42}    0.0010{col 52}    0.0007{col 62}    0.0060{col 72}
{txt}  29{col 4}{res}    0.9395{col 14}    0.1500{col 24}    7242{col 32}    0.0022{col 42}    0.0012{col 52}    0.0002{col 62}    0.0055{col 72}
{txt}  30{col 4}{res}    0.9705{col 14}    0.1500{col 24}    6231{col 32}    0.0016{col 42}    0.0017{col 52}   -0.0018{col 62}    0.0049{col 72}
{txt}{hline 72}

{com}. 
.                 twoway (line lprobust_gx_bc lprobust_eval, ///
>                                         lcolor(gs6) lwidth(medthick)) ///
>                         (line lprobust_CI_l_rb lprobust_eval, ///
>                                 lcolor(gs6) lwidth(thin) lpattern(dash)) ///
>                         (line lprobust_CI_r_rb lprobust_eval, ///
>                                 lcolor(gs6) lwidth(thin) lpattern(dash)), ///
>                         graphregion(color(white)) ///
>                         xline(`cutoff', lcolor(black) lpattern(dash)) ///
>                         yline(0.5, lcolor(black)) ///
>                         ylab(, angle(0)) ///
>                         xlab(0 `cutoff' "`label'" 1) ///
>                         ytitle("Booth-level MAS Margin Minus Precinct Mean") ///
>                         xtitle("Proportion of Preliminary Vote Counted") ///
>                         xsize(7) ysize(5) ///
>                         legend(off)
{res}{txt}
{com}.                 graph export "outputs/generated/Figure_H3b.pdf", replace
{txt}(file outputs/generated/Figure_H3b.pdf written in PDF format)

{com}. 
. *------------------------------------------------------------------------------*
. timer off 2
{txt}
{com}. timer list 2
{res}   2:     36.76 /        1 =      36.7630
{txt}
{com}. 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}E:\Github\Bolivia\00_replication_files\log-files/2_Figure_H3.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}25 Jan 2022, 22:39:59
{txt}{.-}
{smcl}
{txt}{sf}{ul off}